ggplot2 is a graphical system to make plots using the ‘Grammar of Graphics’ggvis is for interactive graphs - I don’t recommend itplotly is betterlibrary(ggplot2)
mpg## # A tibble: 234 × 11
## manufacturer model displ year cyl trans drv cty hwy
## <chr> <chr> <dbl> <int> <int> <chr> <chr> <int> <int>
## 1 audi a4 1.8 1999 4 auto(l5) f 18 29
## 2 audi a4 1.8 1999 4 manual(m5) f 21 29
## 3 audi a4 2.0 2008 4 manual(m6) f 20 31
## 4 audi a4 2.0 2008 4 auto(av) f 21 30
## 5 audi a4 2.8 1999 6 auto(l5) f 16 26
## 6 audi a4 2.8 1999 6 manual(m5) f 18 26
## 7 audi a4 3.1 2008 6 auto(av) f 18 27
## 8 audi a4 quattro 1.8 1999 4 manual(m5) 4 18 26
## 9 audi a4 quattro 1.8 1999 4 auto(l5) 4 16 25
## 10 audi a4 quattro 2.0 2008 4 manual(m6) 4 20 28
## # ... with 224 more rows, and 2 more variables: fl <chr>, class <chr>
ggplot(mpg, aes(x = cty, y = hwy)) +
geom_point()ggplot(mpg, aes(x = cty, y = hwy, colour = cyl)) +
geom_point()ggplot(mpg, aes(x = cty, y = hwy, colour = as.factor(cyl))) +
geom_point()ggplot(mpg, aes(x = cty, y = hwy, colour = as.factor(cyl))) +
geom_point() + scale_color_brewer(palette = "YlOrRd") + theme_dark()ggplot(mpg, aes(x = cty, y = hwy, size = cyl)) +
geom_point()ggplot(mpg, aes(x = cty, y = hwy, shape = as.factor(cyl))) +
geom_point(size = 3)ggplot(mpg, aes(x = cty, y = hwy)) +
geom_point() + facet_grid(.~cyl)ggplot(mpg, aes(x = cty, y = hwy)) +
geom_point() + geom_smooth(method = "lm")ggplot(diamonds, aes(x = carat, y = price)) +
geom_point()ggplot(diamonds, aes(x = carat, y = price)) +
geom_point() + coord_trans(x = "log10", y = "log10")ggplot(mpg, aes(x = as.factor(cyl), y = hwy)) +
geom_bar(stat = "summary", fun.y = "mean")ggplot(mpg, aes(x = factor(1), y = hwy, fill = as.factor(cyl))) +
geom_bar(stat = "summary", fun.y = "mean", width = 1) + coord_polar(theta = "y")ggplot(mpg, aes(x = as.factor(cyl), y = hwy)) +
geom_boxplot()ggplot(mpg, aes(x = as.factor(cyl), y = hwy)) +
geom_violin()ggplot(diamonds, aes(x = carat, price))+
geom_hex()ggplot(diamonds, aes(x = carat, price))+
geom_point() + geom_density_2d() g <- ggplot(mpg, aes(x = cty, y = hwy, colour = as.factor(cyl))) +
geom_point(); ggplotly(g)